package cn.ycc1.boot3task.controller;

import cn.ycc1.boot3task.task.EmailTask;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author ycc
 * @date 2025/10/28
 */
@RestController
@RequestMapping("/test")
public class TestController {
    @Autowired
    private EmailTask emailTask;

    @GetMapping
    public String test() {
        return "test";
    }

    @GetMapping("/send-test-email")
    public String sendTestEmail() {
        emailTask.sendEmail("test@example.com", "手动触发邮件", "这是一封手动触发的测试邮件");
        return "邮件发送任务已提交";
    }

    @GetMapping("/process-data")
    public String processData() {
        emailTask.processData(999);
        return "数据处理任务已提交";
    }

}
